<?php
namespace app\admin\model;

use think\Model;

class ProductCurrency extends Model
{
    public $attributes = [
        'if_show' => [
            0 => '不显示',
            1 => '显示',

        ]
    ];
    public function getCreatorName()
    {
        return $this->getOperator()->bind(['create_name' => 'nickname']);
    }

    public function getUpdateName()
    {
        return $this->getUpdater()->bind(['update_name' => 'nickname']);
    }

    public function getOperator()
    {
        return $this->hasOne(Operator::class, 'id', 'creator');
    }

    public function getUpdater()
    {
        return $this->hasOne(Operator::class, 'id', 'updater');
    }

    public function getValueAttr($value, $data)
    {
        return $value . '';
    }
}
